package com.ck.company.service;

import com.ck.exception.ServiceException;
import com.ck.model.common.Video;
import com.ck.model.common.page.PageInfo;
import com.ck.model.company.vo.CpProgramVideoListVO;
import com.ck.model.company.vo.CpVideoListVO;
import com.github.pagehelper.Page;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;

/**
 * 视频Service
 *
 * @author dxy
 * @date 2018/7/3 14:07
 */
public interface CpVideoService {
	/**
	 * 保存视频
	 *
	 * @param videoFile MultipartFile
	 * @param request   HttpServletRequest
	 */
	Map<String, Object> saveVideo(MultipartFile videoFile, HttpServletRequest request) throws IOException, ServiceException;

	/**
	 * 重命名
	 *
	 * @param videoNewName 视频新名称
	 * @param videoId      视频ID
	 * @param request      HttpServletRequest
	 * @throws ServiceException
	 * @throws IOException
	 */
	void renameVideo(String videoNewName, Long videoId, HttpServletRequest request) throws ServiceException, IOException;

	/**
	 * 视频列表
	 *
	 * @param companyCode 商家编码
	 * @param videoName   视频名称
	 * @param pageNum     当前页
	 * @param pageSize    每页显示条数
	 * @return List<CpVideoListVO>
	 */
	PageInfo<CpVideoListVO> listVideo(String companyCode, String videoName, Integer pageNum, Integer pageSize);

	/**
	 * 通过视频ID删除视频
	 *
	 * @param videoId 视频ID
	 * @param request HttpServletRequest
	 * @throws ServiceException
	 * @throws IOException
	 */
	void deleteVideoById(Long videoId, HttpServletRequest request) throws ServiceException, IOException;

	/**
	 * 查询某商家视频列表
	 *
	 * @param companyCode 商家编码
	 * @param videoName   视频名称
	 * @param pageNum     当前页
	 * @param pageSize    每页条数
	 * @return Page<CpVideoListVO>
	 */
	Page<CpProgramVideoListVO> listProgramVideo(String companyCode, String videoName, Integer pageNum, Integer pageSize);

	/**
	 * 通过视频名称获取视频
	 *
	 * @param companyCode 商家编码
	 * @param videoName   视频名称
	 * @return Video
	 * @throws ServiceException
	 */
	Video getVideoByName(String companyCode, String videoName) throws ServiceException;

	/**
	 * 获取视频名称类似的条数
	 *
	 * @param companyCode 商家编码
	 * @param videoName   视频名称
	 * @return Long(视频条数)
	 * @throws ServiceException
	 */
	Long countVideoByName(String companyCode, String videoName) throws ServiceException;
}
